// Dreher and Gassebner 2012 IO

cd "/Users/ranjitlall/Documents/Ranjit's work/Harvard/Missing data in CIPE/Studies/IO/Dreher and Gassebner 2012 IO"

// Load original dataset
clear
use "DG2012 IO Rep Data.dta"

// REPLICATION
xtset id year
summarize
display c(k)
mdesc
codebook id
codebook year
pwcorr polity2 *

// Table 1
xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb,fe
mfx compute, predict(pu0) nose
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb

xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba,fe
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba

xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba if year >1985,fe
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba

xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb limf limf_sba,fe
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb limf limf_sba

xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb limf limf_sba if year >1985,fe
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb limf limf_sba

xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba lwb lida_dis0_gdp librd_dis0_gdp lsba_dis_gdp lprgf_dis0_gdp,fe
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba lwb lida_dis0_gdp librd_dis0_gdp lsba_dis_gdp lprgf_dis0_gdp

xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba lwb lida_dis0_gdp librd_dis0_gdp lsba_dis_gdp lprgf_dis0_gdp if year>1985,fe
codebook year if e(sample)
codebook id if e(sample)
mdesc crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba lwb lida_dis0_gdp librd_dis0_gdp lsba_dis_gdp lprgf_dis0_gdp

// IMPUTATION
clear
use "DG2012 IO Imp Data.dta"
summarize

mi import flong, m(imp) id(id year) imp(crises-librd_dis0_gdp lwbgr-limfgr)

gen _t0 = 0
gen _t = 0
gen _d = 0
gen _st = 0
gen wdi = 0
mi xtset id year

// Table 1
// Model 1
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb,fe
// Model 2
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba,fe
// Model 3
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba if year >1985,fe
// Model 4
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb limf limf_sba,fe
// Model 5
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr lwb limf limf_sba if year >1985,fe
// Model 6
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba lwb lida_dis0_gdp librd_dis0_gdp lsba_dis_gdp lprgf_dis0_gdp,fe
// Model 7
mi estimate, esampvaryok post: xtlogit crisesadj  yrsaftcrises crises_spline1 crises_spline2 crises_spline3  polity2 durable lnguerilla lnriots lndemons lnstrike lnassas lnpurges lgr limf limf_sba lwb lida_dis0_gdp librd_dis0_gdp lsba_dis_gdp lprgf_dis0_gdp if year>1985,fe
